﻿namespace Photo.Core.SeedData
{
    /// <summary>
    /// 代码模板
    /// </summary>
    public class CodeTemplate
    {
        /// <summary>
        /// Entity.cs
        /// </summary>
        public static string Template_Entity = @"namespace ERP.Entity.${ModuleName}
{
    /// <summary>
    /// ${TableDescription}实体类
    /// </summary>
    [SugarTable(""${TableName}"", ""${TableDescription}"")]
    public class ${EntityName}Entity : BaseEntity
    {
$foreach(item in ColumnList)
        /// <summary>
        /// ${item.ColumnDescription}
        /// </summary>
        public ${item.EntityType} ${item.DbColumnName} { get; set; }
${end}
    }
}";

        /// <summary>
        /// AddInput.cs
        /// </summary>
        public static string Template_AddInput = @"namespace ERP.Application.${ModuleName}.${ServiceName}.Dto
{
    /// <summary>
    /// ${TableDescription}addinput
    /// </summary>
    public class ${ServiceName}AddInput
    {
$foreach(item in FormFieldList)
        /// <summary>
        /// ${item.FieldInfo.ColumnDescription}
        /// </summary>
        public ${item.FieldInfo.EntityType} ${item.FieldInfo.DbColumnName} { get; set; }
${end}
    }
}";

        /// <summary>
        /// EditInput.cs
        /// </summary>
        public static string Template_EditInput = @"namespace ERP.Application.${ModuleName}.${ServiceName}.Dto
{
    /// <summary>
    /// ${TableDescription}editinput
    /// </summary>
    public class ${ServiceName}EditInput : PrimaryKey
    {
$foreach(item in FormFieldList)
        /// <summary>
        /// ${item.FieldInfo.ColumnDescription}
        /// </summary>
        [AdaptMember]
        public ${item.FieldInfo.EntityType} ${item.FieldInfo.DbColumnName} { get; set; }
${end}
    }
}";

        /// <summary>
        /// SaveInput.cs
        /// </summary>
        public static string Template_SaveInput = @"namespace ERP.Application.${ModuleName}.${ServiceName}.Dto
{
    /// <summary>
    /// ${TableDescription}saveinput
    /// </summary>
    public class ${ServiceName}SaveInput : PrimaryKey
    {
$foreach(item in FormFieldList)
        /// <summary>
        /// ${item.FieldInfo.ColumnDescription}
        /// </summary>
        [AdaptMember]
        public ${item.FieldInfo.EntityType} ${item.FieldInfo.DbColumnName} { get; set; }
${end}
    }
}";

        /// <summary>
        /// Output.cs
        /// </summary>
        public static string Template_Output = @"namespace ERP.Application.${ModuleName}.${ServiceName}.Dto
{
    /// <summary>
    /// ${TableDescription}output
    /// </summary>
    public class ${ServiceName}Output : BaseDto
    {
$foreach(item in TableFieldList)
        /// <summary>
        /// ${item.FieldInfo.ColumnDescription}
        /// </summary>
        public ${item.FieldInfo.EntityType} ${item.FieldInfo.DbColumnName} { get; set; }
${end}
    }
}";

        /// <summary>
        /// Dto.cs
        /// </summary>
        public static string Template_Dto = @"namespace ERP.Application.${ModuleName}.${ServiceName}.Dto
{
    /// <summary>
    /// ${TableDescription}dto
    /// </summary>
    public class ${ServiceName}Dto : BaseDto
    {
$foreach(item in ColumnList)
        /// <summary>
        /// ${item.ColumnDescription}
        /// </summary>
        public ${item.EntityType} ${item.DbColumnName} { get; set; }
${end}
    }
}";

        /// <summary>
        /// PagedInput.cs
        /// </summary>
        public static string Template_PagedInput = @"namespace ERP.Application.${ModuleName}.${ServiceName}.Dto
{
    /// <summary>
    /// ${ServiceDescription}pagedinput
    /// </summary>
    public class ${ServiceName}PagedInput : PagedInput
    {
$foreach(item in FilterFieldList)
        /// <summary>
        /// ${item.FieldInfo.ColumnDescription}
        /// </summary>
${if(item.FieldInfo.EntityType_NonEmpty==""DateTime""||item.FieldInfo.EntityType_NonEmpty==""DateOnly""||item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
        public string ${item.FieldInfo.DbColumnName} { get; set; }
${else}
        public ${item.FieldInfo.EntityType} ${item.FieldInfo.DbColumnName} { get; set; }
${end}
${end}
    }
}";

        /// <summary>
        /// Service.cs
        /// </summary>
        public static string Template_Service = @"using ERP.Application.${ModuleName}.${ServiceName}.Dto;

namespace ERP.Application.${ModuleName}.${ServiceName}
{
    /// <summary>
    /// ${ServiceDescription}
    /// </summary>
    [ApiDescriptionSettings(ApiGroupConsts.${ModuleName}, Module = ApiGroupConsts.${ModuleName})]
    public class ${ServiceName}Service : IDynamicApiController
    {
        private readonly IRepository<${EntityName}Entity> _${entity_name}Repository;

        public ${ServiceName}Service(IRepository<${EntityName}Entity> ${entity_name}Repository)
        {
            _${entity_name}Repository = ${entity_name}Repository;
        }

        /// <summary>
        /// 添加${ServiceDescription}
        /// </summary>
        /// <param name=""input""></param>
        /// <returns></returns>
        [SecurityDefine]
        [LockFilter(EnumLockKeyType.UserId)]
        public async Task Add(${ServiceName}AddInput input)
        {
            var entity = input.Adapt<${EntityName}Entity>();

            await _${entity_name}Repository.InsertAsync(entity);
        }

        /// <summary>
        /// 修改${ServiceDescription}
        /// </summary>
        /// <param name=""key""></param>
        /// <param name=""input""></param>
        /// <returns></returns>
        [SecurityDefine]
        [LockFilter(EnumLockKeyType.ParamKey)]
        public async Task Edit(string key, ${ServiceName}EditInput input)
        {
            var entity = await _${entity_name}Repository.GetAsync(input.Id, ""当前${ServiceDescription}不存在"");

            input.AdaptTo(ref entity);

            await _${entity_name}Repository.UpdateAsync(entity);
        }

        /// <summary>
        /// 删除${ServiceDescription}
        /// </summary>
        /// <param name=""key""></param>
        /// <param name=""input""></param>
        /// <returns></returns>
        [SecurityDefine]
        [LockFilter(EnumLockKeyType.ParamKey)]
        public async Task Del(string key, PrimaryKey input)
        {
            var entity = await _${entity_name}Repository.GetAsync(input.Id, ""当前${ServiceDescription}不存在"");

            await _${entity_name}Repository.DeleteAsync(entity);
        }

        /// <summary>
        /// 获取${ServiceDescription}分页列表
        /// </summary>
        /// <param name=""input""></param>
        /// <returns></returns>
        [SecurityDefine]
        public async Task<PagedList<${ServiceName}Output>> GetPagedList(${ServiceName}PagedInput input)
        {
${foreach(item in FilterFieldList)}
${if(item.FieldInfo.EntityType_NonEmpty==""DateTime""||item.FieldInfo.EntityType_NonEmpty==""DateOnly""||item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
            var ${item.FieldInfo.dbcolumn_name}_Start = !string.IsNullOrWhiteSpace(input.${item.FieldInfo.DbColumnName}) ? (${item.FieldInfo.EntityType_NonEmpty}?)${item.FieldInfo.EntityType_NonEmpty}.Parse(input.${item.FieldInfo.DbColumnName}.Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries)[0]) : null;
            var ${item.FieldInfo.dbcolumn_name}_End = !string.IsNullOrWhiteSpace(input.${item.FieldInfo.DbColumnName}) ? (${item.FieldInfo.EntityType_NonEmpty}?)${item.FieldInfo.EntityType_NonEmpty}.Parse(input.${item.FieldInfo.DbColumnName}.Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries)[1]) : null;
${end}
${end}

            var list = await _${entity_name}Repository.Query()
${foreach(item in FilterFieldList)}
${if(item.FieldInfo.EntityType==""string"")}
                .WhereIF(!string.IsNullOrWhiteSpace(input.${item.FieldInfo.DbColumnName}), o => o.${item.FieldInfo.DbColumnName}.Contains(input.${item.FieldInfo.DbColumnName}))
${elif(item.FieldInfo.EntityType==""int?""||item.FieldInfo.EntityType==""long?""||item.FieldInfo.EntityType==""decimal?""||item.FieldInfo.EntityType==""bool?"")}
                .WhereIF(input.${item.FieldInfo.DbColumnName}.HasValue, o => o.${item.FieldInfo.DbColumnName}==input.${item.FieldInfo.DbColumnName})
${elif(item.FieldInfo.EntityType_NonEmpty==""DateTime"")}
                .WhereIF(${item.FieldInfo.dbcolumn_name}_Start.HasValue, o => o.${item.FieldInfo.DbColumnName} >= ${item.FieldInfo.dbcolumn_name}_Start.Value.Date)
                .WhereIF(${item.FieldInfo.dbcolumn_name}_End.HasValue, o => o.${item.FieldInfo.DbColumnName} < ${item.FieldInfo.dbcolumn_name}_End.Value.Date.AddDays(1))
${elif(item.FieldInfo.EntityType_NonEmpty==""DateOnly"")}
                .WhereIF(${item.FieldInfo.dbcolumn_name}_Start.HasValue, o => o.${item.FieldInfo.DbColumnName} >= ${item.FieldInfo.dbcolumn_name}_Start.Value)
                .WhereIF(${item.FieldInfo.dbcolumn_name}_End.HasValue, o => o.${item.FieldInfo.DbColumnName} < ${item.FieldInfo.dbcolumn_name}_End.Value.AddDays(1))
${elif(item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
                .WhereIF(${item.FieldInfo.dbcolumn_name}_Start.HasValue, o => o.${item.FieldInfo.DbColumnName} >= ${item.FieldInfo.dbcolumn_name}_Start.Value)
                .WhereIF(${item.FieldInfo.dbcolumn_name}_End.HasValue, o => o.${item.FieldInfo.DbColumnName} < ${item.FieldInfo.dbcolumn_name}_End.Value)
${end}
${end}
                .OrderByIF(!string.IsNullOrWhiteSpace(input.OrderByField), input.OrderByField)
                .Select<${ServiceName}Output>()
                .ToPagedListAsync(input);

            return list;
        }

        /// <summary>
        /// 获取${ServiceDescription}详情
        /// </summary>
        /// <param name=""input""></param>
        /// <returns></returns>
        [SecurityDefine]
        public async Task<${ServiceName}Dto> GetInfo(PrimaryKey input)
        {
            var info = await _${entity_name}Repository.GetAsync<${ServiceName}Dto>(input.Id, ""当前${ServiceDescription}不存在"");

            return info;
        }
    }
}";

        /// <summary>
        /// main.html
        /// </summary>
        public static string Template_Main = @"<!DOCTYPE html>
<html>

<head>
    <meta charset=""utf-8"">
    <title>${ServiceDescription}</title>
    <link rel=""stylesheet"" href=""/component/pear/css/pear.css"" />
    <script src=""/component/layui/layui.js""></script>
    <script src=""/component/pear/pear.js""></script>
</head>

<body class=""pear-container"">
    <div class=""layui-card"">
        <div class=""layui-collapse"">
            <div class=""layui-colla-item"">
                <h2 class=""layui-colla-title"">条件筛选<i class=""layui-icon layui-colla-icon""></i></h2>
                <div class=""layui-colla-content layui-show"">
                    <div class=""layui-card-body"">
                        <form class=""layui-form layui-form-wd120"" action="""" autocomplete=""off"" lay-filter=""filterForm"">
                            <input type=""hidden"" name=""orderByField"" value=""creationTime desc"">
                            <div class=""layui-form-item"">
								<div class=""layui-inline"">
									<label class=""layui-form-label"">关键词</label>
									<div class=""layui-input-inline"">
										<input type=""text"" name=""keyword"" placeholder=""模糊查询"" class=""layui-input"">
									</div>
								</div>
${foreach(item in FilterFieldList)}
${if(item.FieldType==1||item.FieldType==7)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <input type=""text"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
                                    </div>
                                </div>
${elif(item.FieldType==2)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <textarea name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-textarea""></textarea>
                                    </div>
                                </div>
${elif(item.FieldType==3||item.FieldType==4||item.FieldType==10)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <div id=""${item.FieldInfo.dbcolumn_name}""></div>
                                    </div>
                                </div>
                            </div>
${elif(item.FieldType==6)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <select id=""${item.FieldInfo.dbcolumn_name}"" name=""${item.FieldInfo.dbcolumn_name}"" lay-search></select>
                                    </div>
                                </div>
${elif(item.FieldType==9)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <div id=""${item.FieldInfo.dbcolumn_name}s""></div>
                                    </div>
                                </div>
${elif(item.FieldType==5)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <input type=""checkbox"" name=""${item.FieldInfo.dbcolumn_name}"" lay-skin=""switch"" lay-text=""是|否"">
                                    </div>
                                </div>
${elif(item.FieldType==8)}
                                <div class=""layui-inline"">
                                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
                                    <div class=""layui-input-inline"">
                                        <input type=""text"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请选择${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
                                    </div>
                                </div>
${end}
${end}
                            </div>
                            <div class=""layui-form-item"">
                                <div class=""layui-input-block"">
                                    <button class=""pear-btn pear-btn-md pear-btn-primary"" lay-submit lay-filter=""filter"">
                                        <i class=""layui-icon layui-icon-search""></i>
                                        查询
                                    </button>
                                    <button type=""reset"" lay-click=""reset"" class=""pear-btn pear-btn-md"">
                                        <i class=""layui-icon layui-icon-refresh""></i>
                                        重置
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class=""layui-card"">
        <div class=""layui-card-body"">
            <table id=""table"" lay-filter=""table""></table>
        </div>
    </div>

</body>

</html>

<script type=""text/html"" id=""toolbar"">
    <button class=""pear-btn pear-btn-primary pear-btn-md"" lay-event=""add"">
        <i class=""layui-icon layui-icon-add-1""></i>
        新增
    </button>
</script>

<script type=""text/html"" id=""bar"">
    <button plain class=""pear-btn pear-btn-primary pear-btn-xs"" lay-event=""edit"">修改</button>
    <button plain class=""pear-btn pear-btn-warming pear-btn-xs"" lay-event=""info"">详情</button>
    <button plain class=""pear-btn pear-btn-danger pear-btn-xs"" lay-event=""del"">删除</button>
</script>
${foreach(item in FilterFieldList)}
${if(item.FieldType==5)}
<!--开关-${item.FieldInfo.ColumnDescription}-->
<script type=""text/html"" id=""templet-${item.FieldInfo.dbcolumn_name}"">
    {{#if(d.${item.FieldInfo.dbcolumn_name}){}}
    <input type=""checkbox"" name=""${item.FieldInfo.dbcolumn_name}"" value=""{{d.id}}"" lay-skin=""switch"" lay-text=""是|否"" lay-filter=""templet-${item.FieldInfo.dbcolumn_name}"" checked }}>
    {{# }else { }}
    <input type=""checkbox"" name=""${item.FieldInfo.dbcolumn_name}"" value=""{{d.id}}"" lay-skin=""switch"" lay-text=""是|否"" lay-filter=""templet-${item.FieldInfo.dbcolumn_name}"" }}>
    {{# } }}
</script>
${end}
${end}

<script>
	layui.use(['table', 'form', 'jquery', 'popup', 'common', 'context', 'permission', 'tableext', 'xmSelect', 'util', 'laydate', 'tips'], function () {
		var table = layui.table;
		var form = layui.form;
		var $ = layui.jquery;
		var common = layui.common;
		var context = layui.context;
		var popup = layui.popup;
		var util = layui.util;
		var xmSelect = layui.xmSelect;
		var laydate = layui.laydate;

		var basePath = context.get(""base-path"");

${foreach(item in FilterFieldList)}
${if(item.FieldType==7)}
		//加载${item.FieldInfo.ColumnDescription}日期选择框
		laydate.render({
			elem: 'input[name=${item.FieldInfo.dbcolumn_name}]',
			format: 'yyyy-MM-dd'
		});${elif(item.FieldType==8)}
		//加载${item.FieldInfo.ColumnDescription}日期范围选择框
		laydate.render({
			elem: 'input[name=${item.FieldInfo.dbcolumn_name}]',
			format: 'yyyy-MM-dd',
			range: '~'
		});
${end}
${end}

${foreach(item in FilterFieldList)}
${if(item.FieldType==3)}
		//加载${item.FieldInfo.ColumnDescription}单选框
		common.loadRadio({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
			defaultItem: ""全部"",
		});
${elif(item.FieldType==4)}
		//加载${item.FieldInfo.ColumnDescription}复选框
		common.loadCheckBox({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
			defaultItem: ""全部"",
		});
${elif(item.FieldType==6)}
		//加载${item.FieldInfo.ColumnDescription}单选下拉框
		common.loadSelect({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
			defaultItem: ""全部"",
		});
${elif(item.FieldType==9)}
		//加载${item.FieldInfo.ColumnDescription}多选下拉框
		common.loadXmSelect({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		})
${elif(item.FieldType==10)}
		//加载${item.FieldInfo.ColumnDescription}下拉树
		common.loadXmSelectTree({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
		});
${end}
${end}

		table.render({
			elem: '#table',
			url: basePath + '/api/${module_name}/${service_name}/getpagedlist',
			toolbar: '#toolbar',
            where: form.val(""filterForm""),
			cols: [[
				{ title: '编号', field: 'id', hide: true },
${foreach(item in TableFieldList)}
${if(item.IsSort)}
				{ title: '${item.FieldInfo.ColumnDescription}', field: '${item.FieldInfo.dbcolumn_name}', sort: true, width: 200 },
${else}
				{ title: '${item.FieldInfo.ColumnDescription}', field: '${item.FieldInfo.dbcolumn_name}', width: 200 },
${end}
${end}
				{ title: '操作', toolbar: '#bar', fixed: 'right', width: 180 }
			]],
			done: function (res, curr, count) {
				common.renderUnique();
			}
		});

		//table排序监听
		table.on('sort(table)', function (obj) {
			let orderByField = """";
			if (obj.type != null) {
				orderByField = obj.field + "" "" + obj.type
			} else {
				orderByField = """"
			}
			form.val(""filterForm"", { orderByField: orderByField });
			table.reload('table', {
				where: form.val(""filterForm"")
			})
		})

		//table操作栏
		table.on('tool(table)', function (obj) {
			if (obj.event === 'edit') {
				window.edit(obj);
			} else if (obj.event === 'info') {
				window.info(obj);
			} else if (obj.event === 'del') {
				window.del(obj);
			}
		});

		//table工具栏
		table.on('toolbar(table)', function (obj) {
			if (obj.event === 'add') {
				window.add(obj);
			} else if (obj.event === 'refresh') {
				window.refresh()
			}
		});

		//查询
		form.on('submit(filter)', function (data) {
			table.reload('table', {
				where: data.field,
				page: {
					curr: 1 //重新从第 1 页开始
				}
			})
			return false;
		});

		util.event('lay-click', {
			reset: function (othis) {//重置搜索表单
				form.render();
${foreach(item in FilterFieldList)}
${if(item.FieldType==9||item.FieldType==10)}
				xmSelect.get('#${item.FieldInfo.dbcolumn_name}s',true).setValue([ ]);
${end}
${end}
			},
		});

${foreach(item in FilterFieldList)}
${if(item.FieldType==5)}
		form.on('switch(templet-${item.FieldInfo.dbcolumn_name})', function (obj) {
			$.ajax({
				url: basePath + '/api/${module_name}/${service_name}/setactive/' + obj.value,
				data: JSON.stringify({ ""id"": obj.value }),
				success: function (result) {
					if (result.succeeded) {
						popup.success(""设置成功"");
					} else {
						popup.failure(JSON.stringify(result.errors));
					}
				}
			})
		});
${end}
${end}

		window.add = function (obj) {
			layer.open({
				type: 2,
				title: '新增${ServiceDescription}',
				area: ['500px', '500px'],
				content: 'add.html?fresh=' + Math.random()
			});
		}
		window.edit = function (obj) {
			layer.open({
				type: 2,
				title: '修改${ServiceDescription}',
				area: ['500px', '500px'],
				content: 'edit.html?id=' + obj.data['id'] + '&fresh=' + Math.random()
			});
		}
		window.info = function (obj) {
			layer.open({
				type: 2,
				title: '${ServiceDescription}详情',
				area: ['500px', '500px'],
				content: 'info.html?id=' + obj.data['id'] + '&fresh=' + Math.random()
			});
		}
		window.del = function (obj) {
			let lock = false;
			layer.confirm('确定要删除该${ServiceDescription}吗', {
				icon: 3,
				title: '提示'
			}, function (index) {
				if (!lock) {
					lock = true;
					layer.close(index);
					let id = obj.data['id'];
					let loading = layer.load();
					$.ajax({
						url: basePath + ""/api/${module_name}/${service_name}/del/"" + id,
						data: JSON.stringify({ id: id }),
						success: function (result) {
							layer.close(loading);
							if (result.succeeded) {
								popup.success(""删除成功"", function () {
									obj.del();
								});
							} else {
								popup.failure(JSON.stringify(result.errors));
							}
						}
					})
				}
			});
		}
		window.refresh = function () {
			table.reload('table')
		}
	})
</script>";

        /// <summary>
        /// add.html
        /// </summary>
        public static string Template_Add = @"<!DOCTYPE html>
<html>

<head>
    <meta charset=""UTF-8"">
    <title>新增${ServiceDescription}</title>
    <link rel=""stylesheet"" href=""/component/pear/css/pear.css"" />
    <script src=""/component/layui/layui.js""></script>
    <script src=""/component/pear/pear.js""></script>
</head>

<body>
    <form class=""layui-form"" action="""" lay-filter=""form"" autocomplete=""off"">
        <div class=""mainBox"">
            <div class=""main-container"">
${foreach(item in FormFieldList)}
                <div class=""layui-form-item"">
${if(item.IsRequired==true)}
                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}<span class=""layui-font-red"">*</span></label>
${else}
                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
${end}
                    <div class=""layui-input-block"">
${if(item.FieldType==1||item.FieldType==7)}
${if(item.IsRequired==true)}
${if(item.FieldInfo.EntityType_NonEmpty==""int""||item.FieldInfo.EntityType_NonEmpty==""long"")}
                        <input type=""number"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""decimal"")}
                        <input type=""number"" step=""0.01"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""string""||item.FieldInfo.EntityType_NonEmpty==""DateTime""||item.FieldInfo.EntityType_NonEmpty==""DateOnly""||item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
                        <input type=""text"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${end}
${else}
${if(item.FieldInfo.EntityType_NonEmpty==""int""||item.FieldInfo.EntityType_NonEmpty==""long"")}
                        <input type=""number"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""decimal"")}
                        <input type=""number"" step=""0.01"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""string""||item.FieldInfo.EntityType_NonEmpty==""DateTime""||item.FieldInfo.EntityType_NonEmpty==""DateOnly""||item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
                        <input type=""text"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${end}
${end}
${elif(item.FieldType==2)}
${if(item.IsRequired==true)}
                        <textarea name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-textarea""></textarea>
${else}
                        <textarea name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-textarea""></textarea>
${end}
${elif(item.FieldType==3||item.FieldType==4||item.FieldType==10)}
                        <div id=""${item.FieldInfo.dbcolumn_name}""></div>
${elif(item.FieldType==6)}
${if(item.IsRequired==true)}
                        <select id=""${item.FieldInfo.dbcolumn_name}"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" lay-search></select>
${else}
                        <select id=""${item.FieldInfo.dbcolumn_name}"" name=""${item.FieldInfo.dbcolumn_name}"" lay-search></select>
${end}
${elif(item.FieldType==9)}
                        <div id=""${item.FieldInfo.dbcolumn_name}s""></div>
${elif(item.FieldType==5)}
                        <input type=""checkbox"" name=""${item.FieldInfo.dbcolumn_name}"" lay-skin=""switch"" lay-text=""是|否"">
${end}
                    </div>
                </div>
${end}
            </div>
        </div>
        <div class=""bottom"">
            <div class=""button-container"">
                <button type=""submit"" class=""pear-btn pear-btn-sm pear-btn-primary"" lay-submit="""" lay-filter=""save"">
                    <i class=""icon pear-icon pear-icon-select-bold""></i>
                    提交
                </button>
                <button type=""button"" lay-click=""layerclose"" class=""pear-btn pear-btn-sm"">
                    <i class=""icon pear-icon pear-icon-close-bold""></i>
                    关闭
                </button>
            </div>
        </div>
    </form>
</body>

</html>

<script>
    layui.use(['form', 'jquery', 'context', 'permission', 'popup', 'common', 'button', 'util', 'xmSelect', 'laydate'], function () {
        var $ = layui.jquery;
        var form = layui.form;
        var context = layui.context;
        var popup = layui.popup;
        var common = layui.common;
        var button = layui.button;
        var util = layui.util;
        var xmSelect = layui.xmSelect;
        var laydate = layui.laydate;

        var basePath = context.get(""base-path"");
        
${foreach(item in FormFieldList)}
${if(item.FieldType==7)}
		//加载${item.FieldInfo.ColumnDescription}日期选择框
		laydate.render({
			elem: 'input[name=${item.FieldInfo.dbcolumn_name}]',
			format: 'yyyy-MM-dd'
		});
${end}
${end}

${foreach(item in FormFieldList)}
${if(item.FieldType==3)}
		//加载${item.FieldInfo.ColumnDescription}单选框
		common.loadRadio({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==4)}
		//加载${item.FieldInfo.ColumnDescription}复选框
		common.loadCheckBox({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==6)}
		//加载${item.FieldInfo.ColumnDescription}单选下拉框
		common.loadSelect({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==9)}
		//加载${item.FieldInfo.ColumnDescription}多选下拉框
		common.loadXmSelect({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==10)}
		//加载${item.FieldInfo.ColumnDescription}下拉树
		common.loadXmSelectTree({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
		});
${end}
${end}

        form.on('submit(save)', function (data) {
${foreach(item in FormFieldList)}
${if(item.FieldInfo.EntityType_NonEmpty==""bool"")}
			data.field.${item.FieldInfo.dbcolumn_name} = data.field.${item.FieldInfo.dbcolumn_name} == ""on"" ? true : false;
${end}
${end}

            var btn = button.load({ elem: 'button[lay-filter=save]' });
            $.ajax({
                url: basePath + '/api/${module_name}/${service_name}/add',
                data: JSON.stringify(data.field),
                success: function (result) {
                    btn.stop(function () {
                        if (result.succeeded) {
                            popup.success(""添加成功"", function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                                parent.window.refresh();
                            });
                        } else {
                            popup.failure(JSON.stringify(result.errors));
                        }
                    })
                }
            })

            return false;
        });

        util.event('lay-click', {
            layerclose: function (othis) {//关闭当前弹窗
                parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
            },
        });
    })
</script>";

        /// <summary>
        /// edit.html
        /// </summary>
        public static string Template_Edit = @"<!DOCTYPE html>
<html>

<head>
    <meta charset=""UTF-8"">
    <title>修改${ServiceDescription}</title>
    <link rel=""stylesheet"" href=""/component/pear/css/pear.css"" />
    <script src=""/component/layui/layui.js""></script>
    <script src=""/component/pear/pear.js""></script>
</head>

<body>
    <form class=""layui-form"" action="""" lay-filter=""form"" autocomplete=""off"">
        <div class=""mainBox"">
            <div class=""main-container"">
${foreach(item in FormFieldList)}
                <div class=""layui-form-item"">
${if(item.IsRequired==true)}
                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}<span class=""layui-font-red"">*</span></label>
${else}
                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
${end}
                    <div class=""layui-input-block"">
${if(item.FieldType==1||item.FieldType==7)}
${if(item.IsRequired==true)}
${if(item.FieldInfo.EntityType_NonEmpty==""int""||item.FieldInfo.EntityType_NonEmpty==""long"")}
                        <input type=""number"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""decimal"")}
                        <input type=""number"" step=""0.01"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""string""||item.FieldInfo.EntityType_NonEmpty==""DateTime""||item.FieldInfo.EntityType_NonEmpty==""DateOnly""||item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
                        <input type=""text"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${end}
${else}
${if(item.FieldInfo.EntityType_NonEmpty==""int""||item.FieldInfo.EntityType_NonEmpty==""long"")}
                        <input type=""number"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""decimal"")}
                        <input type=""number"" step=""0.01"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${elif(item.FieldInfo.EntityType_NonEmpty==""string""||item.FieldInfo.EntityType_NonEmpty==""DateTime""||item.FieldInfo.EntityType_NonEmpty==""DateOnly""||item.FieldInfo.EntityType_NonEmpty==""TimeOnly"")}
                        <input type=""text"" name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-input"">
${end}
${end}
${elif(item.FieldType==2)}
                        <textarea name=""${item.FieldInfo.dbcolumn_name}"" placeholder=""请输入${item.FieldInfo.ColumnDescription}"" class=""layui-textarea""></textarea>
${elif(item.FieldType==3||item.FieldType==4||item.FieldType==10)}
                        <div id=""${item.FieldInfo.dbcolumn_name}""></div>
${elif(item.FieldType==6)}
${if(item.IsRequired==true)}
                        <select id=""${item.FieldInfo.dbcolumn_name}"" name=""${item.FieldInfo.dbcolumn_name}"" lay-verify=""required"" lay-search></select>
${else}
                        <select id=""${item.FieldInfo.dbcolumn_name}"" name=""${item.FieldInfo.dbcolumn_name}"" lay-search></select>
${end}
${elif(item.FieldType==9)}
                        <div id=""${item.FieldInfo.dbcolumn_name}s""></div>
${elif(item.FieldType==5)}
                        <input type=""checkbox"" name=""${item.FieldInfo.dbcolumn_name}"" lay-skin=""switch"" lay-text=""是|否"">
${end}
                    </div>
                </div>
${end}
            </div>
        </div>
        <div class=""bottom"">
            <div class=""button-container"">
                <button type=""submit"" class=""pear-btn pear-btn-sm pear-btn-primary"" lay-submit="""" lay-filter=""save"">
                    <i class=""icon pear-icon pear-icon-select-bold""></i>
                    提交
                </button>
                <button type=""button"" lay-click=""layerclose"" class=""pear-btn pear-btn-sm"">
                    <i class=""icon pear-icon pear-icon-close-bold""></i>
                    关闭
                </button>
            </div>
        </div>
    </form>
</body>

</html>

<script>
	layui.use(['form', 'jquery', 'context', 'permission', 'popup', 'common', 'button', 'util', 'xmSelect', 'laydate'], function () {
		var form = layui.form;
		var $ = layui.jquery;
		var context = layui.context;
		var popup = layui.popup;
		var common = layui.common;
		var button = layui.button;
		var util = layui.util;
		var xmSelect = layui.xmSelect;
		var laydate = layui.laydate;

		var basePath = context.get(""base-path"");

		var currentId = common.getQueryString(""id"");

${foreach(item in FormFieldList)}
${if(item.FieldType==7)}
		//加载${item.FieldInfo.ColumnDescription}日期选择框
		laydate.render({
			elem: 'input[name=${item.FieldInfo.dbcolumn_name}]',
			format: 'yyyy-MM-dd'
		});
${end}
${end}

${foreach(item in FormFieldList)}
${if(item.FieldType==3)}
		//加载${item.FieldInfo.ColumnDescription}单选框
		common.loadRadio({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==4)}
		//加载${item.FieldInfo.ColumnDescription}复选框
		common.loadCheckBox({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==6)}
		//加载${item.FieldInfo.ColumnDescription}单选下拉框
		common.loadSelect({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		})
${elif(item.FieldType==9)}
		//加载${item.FieldInfo.ColumnDescription}多选下拉框
		common.loadXmSelect({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
${if(item.DataSourceType==1)}
			keyField: ""key"",
			valueField: ""description"",
			url: basePath + '/api/core/enum/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${elif(item.DataSourceType==2)}
			url: basePath + '/api/core/dict/getlist',
			data: JSON.stringify({ ""content"": ""${item.DataSource}"" }),
${else}
			url: basePath + 'xxxxxxxx',
			data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
${end}
		});
${elif(item.FieldType==10)}
		common.loadXmSelectTree({
			divId: ""#${item.FieldInfo.dbcolumn_name}"",
			name: ""${item.FieldInfo.dbcolumn_name}"",
			url: basePath + '${item.DataSource}',
			//data: JSON.stringify({ ""content"": ""xxxxxxxx"" }),
		});
${end}
${end}

        $.ajax({
			url: basePath + '/api/${module_name}/${service_name}/getinfo',
			data: JSON.stringify({ id: currentId }),
			success: function (result) {
				form.val(""form"", result.data);//表单赋值
${foreach(item in FormFieldList)}
${if(item.FieldType==9||item.FieldType==10)}
				xmSelect.get('#${item.FieldInfo.dbcolumn_name}s', true).setValue(result.data.${item.FieldInfo.dbcolumn_name}s)
${end}
${end}
			}
		})

		form.on('submit(save)', function (data) {
			data.field.id = currentId;
${foreach(item in FormFieldList)}
${if(item.FieldInfo.EntityType_NonEmpty==""bool"")}
			data.field.${item.FieldInfo.dbcolumn_name} = data.field.${item.FieldInfo.dbcolumn_name} == ""on"" ? true : false;
${end}
${end}

			var btn = button.load({ elem: 'button[lay-filter=save]' });
			$.ajax({
				url: basePath + '/api/${module_name}/${service_name}/edit/' + currentId,
				data: JSON.stringify(data.field),
				success: function (result) {
					btn.stop(function () {
						if (result.succeeded) {
							popup.success(""修改成功"", function () {
								parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
								parent.window.refresh();
							});
						} else {
							popup.failure(JSON.stringify(result.errors));
						}
					})
				}
			})
			return false;
		});

		util.event('lay-click', {
			layerclose: function (othis) {//关闭当前弹窗
				parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
			},
		});
	})
</script>";

        /// <summary>
        /// info.html
        /// </summary>
        public static string Template_Info = @"<!DOCTYPE html>
<html>

<head>
    <meta charset=""UTF-8"">
    <title>${ServiceDescription}详情</title>
    <link rel=""stylesheet"" href=""/component/pear/css/pear.css"" />
    <script src=""/component/layui/layui.js""></script>
    <script src=""/component/pear/pear.js""></script>
</head>

<body>
    <form class=""layui-form"" action="""" lay-filter=""form"" autocomplete=""off"">
        <div class=""mainBox"">
            <div class=""main-container"">
${foreach(item in FormFieldList)}
                <div class=""layui-form-item"">
${if(item.IsRequired==true)}
                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}<span class=""layui-font-red"">*</span></label>
${else}
                    <label class=""layui-form-label"">${item.FieldInfo.ColumnDescription}</label>
${end}
                    <div class=""layui-input-block"">
						<label class=""layui-form-mid"" name=""${item.FieldInfo.dbcolumn_name}""></label>
                    </div>
                </div>
${end}
            </div>
        </div>
        <div class=""bottom"">
            <div class=""button-container"">
                <button type=""button"" lay-click=""layerclose"" class=""pear-btn pear-btn-sm"">
                    <i class=""icon pear-icon pear-icon-close-bold""></i>
                    关闭
                </button>
            </div>
        </div>
    </form>
</body>

</html>

<script>
	layui.use(['form', 'jquery', 'context', 'permission', 'popup', 'common', 'button', 'util', 'xmSelect'], function () {
		var form = layui.form;
		var $ = layui.jquery;
		var context = layui.context;
		var popup = layui.popup;
		var common = layui.common;
		var button = layui.button;
		var util = layui.util;
		var xmSelect = layui.xmSelect;

		var basePath = context.get(""base-path"");

		var currentId = common.getQueryString(""id"");


		$.ajax({
			url: basePath + '/api/${module_name}/${service_name}/getinfo',
			data: JSON.stringify({ id: currentId }),
			success: function (result) {
                $.each($(""label[name]""), function (index, item) {
                    $(item).text(result.data[$(item).attr(""name"")]??"""");
                })
			}
		})

		util.event('lay-click', {
			layerclose: function (othis) {//关闭当前弹窗
				parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
			},
		});
	})
</script>";

    }
}
